package cc.comac.mom.controller;

import cc.comac.mom.bean.EquipMaintainWorkOrderBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipMaintainWorkOrderExecutionService;
import cc.comac.mom.bean.EquipMaintainWorkOrderExecution;
import cc.comac.mom.util.ResultBean;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/EquipMaintainWorkOrderExecution")
public class EquipMaintainWorkOrderExecutionController {

	@Autowired
	private EquipMaintainWorkOrderExecutionService equipMaintainWorkOrderExecutionService;
	@ApiOperation("更新保养基准执行数据")
	@RequestMapping(value = "/EquipMaintainWorkOrderExecution", method = RequestMethod.POST)
	public ResultBean updateMaintainWorkOrderExecution(
			@RequestBody EquipMaintainWorkOrderExecution equipMaintainWorkOrderExecution) {
		ResultBean updateMaintainWorkOrderExecution = equipMaintainWorkOrderExecutionService.updateMaintainWorkOrderExecution(equipMaintainWorkOrderExecution);
		return updateMaintainWorkOrderExecution;
	}

	@ApiOperation("查询保养执行数据")
	@RequestMapping(value = "/selectByCondition", method = RequestMethod.POST)
	public ResultBean selectByCondition(@RequestBody EquipMaintainWorkOrderBean equipMaintainWorkOrderExecution) {
		ResultBean selectByOrderId = equipMaintainWorkOrderExecutionService.selectByCondition(equipMaintainWorkOrderExecution);
		return selectByOrderId;
	}

	@ApiOperation("查询保养基准执行数据")
	@RequestMapping(value = "/selectByOrderId", method = RequestMethod.POST)
	public ResultBean selectByOrderId(@RequestBody EquipMaintainWorkOrderExecution equipMaintainWorkOrderExecution) {
		ResultBean selectByOrderId = equipMaintainWorkOrderExecutionService.selectByOrderId(equipMaintainWorkOrderExecution);
		return selectByOrderId;
	}
	
	@ApiOperation("开始执行")
		@RequestMapping(value = "/startExecution", method = RequestMethod.POST)
		public ResultBean startExecution(@RequestBody EquipMaintainWorkOrderExecution equipMaintainWorkOrderExecution) {
			ResultBean startExecution = equipMaintainWorkOrderExecutionService.startExecution(equipMaintainWorkOrderExecution);
			return startExecution;
		}

		@ApiOperation("执行按钮")
		@RequestMapping(value = "/executionBenchmark", method = RequestMethod.POST)
		public ResultBean executionBenchmark(@RequestBody EquipMaintainWorkOrderExecution equipMaintainWorkOrderExecution) {
			ResultBean executionBenchmark = equipMaintainWorkOrderExecutionService.executionBenchmark(equipMaintainWorkOrderExecution);
			return executionBenchmark;
		}

}
